﻿/*
public var images:XMLList;
		public var currentImage:XML;
		public var currentTitle:String;
		public var currentFile:String;
		
		public function SlideshowModel()
		{
			
		}
		
		override protected function updateData():void
		{
			currentImage = images[currentIndex];
			totalItems = images.length();
			currentTitle = currentImage.title;
			currentFile = currentImage.file;
		}
*/

/**
 *
 * @title: Basic MVC Framework, View Class
 * @author: 
 * @license: 
 * @updated: 29/07/2010
 *
 * @version	1.0 
 */

package com.mediagallary.view {

	import com.mediagallary.model.*;
	import com.mediagallary.controller.*;
	import com.mediagallary.view.*;
	import com.mediagallary.utils.*;
	//import com.mediagallary.events.CustomEvent;
	
	import gs.TweenLite;
	
	import flash.display.*;
	import flash.events.Event;
	import flash.net.URLRequest;

	import flash.filters.DropShadowFilter;
	import flash.events.EventDispatcher;
	import flash.events.MouseEvent;
	import flash.events.Event;
	import flash.display.Sprite;
	
	/**
	 * Basic View class in Model/View/Controller triad.
	 */
	public class ImageView extends View {
		
		private var _model:Model;
		private var _controller:Controller;
		
		private var loader:Loader;
		private var bmp:Bitmap;
		private var container:Sprite;
		public var buttonsMc:MovieClip;
		
		// store a reference to the _controller:
		//private var _controller:GallaryController;
		
		private var stageWidth:Number = 550;
		private var stageHeight:Number = 400;

		// we will only allow the user to getNext/Prev image if we 
		// are not currentlyanimating a transition between 2 images:
		private var isAnimating:Boolean;
		
		private var baseURL:String = "./";
		
		private var imageLoader:ImageLoader;
		
		public function ImageView(m:Model, c:Controller, container:Sprite) {
			super(m, c)
			
			this.container = container;
			//addChild(container);
		}
		
		override public function loaded(event:Event = null):void
		{
			//trace("IMAGE URL : " + baseURL + model.currentFile );
			var path:String = baseURL + model.gallaryData.item[model.currentIndex].file;
			trace("ImageView update model.currentIndex : "+model.currentIndex+", path : "+path);
			imageLoader = new ImageLoader();
			imageLoader.loadImage(path);
			/*imageLoader.x = (stageWidth / 2) - (imageLoader.width / 2);
		  	imageLoader.y = (stageHeight / 2) - (imageLoader.height / 2);*/
			container.addChild(imageLoader);
		}


		
		// show/hide the play & pause buttons to reflect the action currently avalible to the user:
		// the two buttons are stacked on the stage
		/*public function showButton(b:String):void
		{  
			if(b == "play")
			{
				buttonsMc.play_btn.visible = true;
				buttonsMc.pause_btn.visible = false;
			}
			else
			{
				buttonsMc.play_btn.visible = false;
				buttonsMc.pause_btn.visible = true;
			}	
		}*/
		
		
	}
}